Program PowerSkin;{$mode objfpc}{$H+}

Uses
  {$IFDEF UNIX}
  {$IFDEF UseCThreads}
    Cthreads,
  {$ENDIF}
  {$ENDIF}
    Classes, Forms, Interfaces, Windows,
    myDebug, myFileUtils, myWinCELib, myPages,
    Sdl;

Var
    SkinProf: TPageInfo;
    {$IFDEF WINDOWS}
    {$R PowerSkin.rc}
    {$ENDIF}

Begin
    Application.Initialize;
    SDL_Init(SDL_INIT_VIDEO);
    SDL_WM_SetCaption(PChar(AppName), Nil);
    SkinProf := TPageInfo.Create();
    DebugLog := TLogClass.Create();
    If not SkinProf.Initialized Then
    Begin
        FreeAndNil(SkinProf);
        SDL_Quit();
        Application.Terminate;
        Application.FreeOnRelease;
    End;
    SkinProf.CommandStr := '%LOAD%,' + SkinProf.Name;
    While True Do
    Begin
        Application.ProcessMessages;
        If SkinProf.CommandStr <> '' Then
        Begin
            SkinProf.Execute();
            If GetCommand(SkinProf.CommandStr) = '%QUIT%' Then Break;
            If GetCommand(SkinProf.CommandStr) = '%LOAD%' Then
            Begin
                If not SkinProf.Loaded Then Break;
                SkinProf.DisplayPage();
            End;
            If GetCommand(SkinProf.CommandStr) = '%RUNWAIT%' Then
            Begin
                If not SkinProf.Loaded Then Break;
                SkinProf.DisplayPage();
            End;
        End;
        SkinProf.CommandStr := '';
        SkinProf.HandleEvent;
        Application.ProcessMessages;
    End;
    FreeAndNil(SkinProf);
    SDL_Quit();
    Application.Terminate;
    Application.FreeOnRelease;
End.
